import React from 'react'
import Formlist from '../../component/Formlist'
import { useLocation } from 'react-router-dom'
import { Button, Collapse } from 'antd-mobile'
import axios from '../../api/axios'
function index() {
    const id=new Date().getTime()
    const {state}=useLocation()
    console.log(state);
    const zhifu=()=>{
        axios.get('/pay',{params:{title:'车票支付',id:id,price:state.tick.vip}}).then(res=>{
            console.log(res);
            window.open(res.data.data)
        })
    }
  return (
    <div>
        <Formlist v={state}></Formlist>
         <Collapse accordion>
          <Collapse.Panel key='1' title='商务座'>
            商务座：{state.tick.vip} <Button onClick={zhifu}>订</Button>
          </Collapse.Panel>
          <Collapse.Panel key='2' title='一等座'>
            一等座：{state.tick.firstTick}
          </Collapse.Panel>
          <Collapse.Panel key='3' title='二等座'>
            二等座：{state.tick.secondTick}
          </Collapse.Panel>
        </Collapse>
    </div>
  )
}

export default index